package com.cg.controller;

import com.cg.client.SystemClient;
import com.cg.dto.DepartmentDto;
import com.cg.dto.Result;
import com.cg.entity.Department;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @ClassName SystemController
 * @Description 面向用户接口
 * @Author CG
 * @Date 2023/12/1 9:23
 **/
@RestController
@RequestMapping("/dep")
public class DepartmentController {

    @Resource
    private SystemClient systemClient;

    /**
     * 查询部门表信息全部信息
     * @return
     */
    @PostMapping("/queryAll")
    public Result<List<Department>> queryAll(){
        return systemClient.queryAll();
    }


    /**
     * 分页查询并根据部门名称模糊查询展示部门信息
     * @param departmentDto
     * @return
     */
    @PostMapping("/queryDepByDepName")
    public Result<Map<String,Object>> queryDepByDepName(DepartmentDto departmentDto){
        return systemClient.queryDepByDepName(departmentDto);
    }
}
